package com.atguigu.tingshu.user.client;

import com.atguigu.tingshu.common.cache.GuiguCache;
import com.atguigu.tingshu.model.user.UserInfo;
import com.atguigu.tingshu.user.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
 * 用户内部调用
 */
@RestController
@RequestMapping("/client/user/userInfo")
public class UserInfoClientController {
    @Autowired
    UserInfoService userInfoService;

    /**
     * 用户新详情
     * @param userId
     * @return
     */
    @GuiguCache(name = "getUSerInfo:")
    @GetMapping(value = "/getuserInfo/{userId}")
    public UserInfo getUSerInfo(@PathVariable(value = "userId")Long userId){
        return userInfoService.getById(userId);
    }
}
